import request from '@/utils/request'

export const login = data => {
  return request({
    url: 'mp/v1_0/authorizations',
    method: 'post',
    data
  })
}

export const updateUserPhoto = data => {
  return request({
    url: 'mp/v1_0/user/photo',
    method: 'patch',
    data
  })
}
// 跟新用户
export const updateUserProfile = data => {
  return request({
    url: 'mp/v1_0/user/profile',
    method: 'patch',
    data
  })
}
export const getUserProfile = () => {
  return request({
    url: 'mp/v1_0/user/profile',
    method: 'get'
  })
}

export const getImages = params => {
  return request({
    url: 'mp/v1_0/user/images',
    method: 'get',
    params
  })
}
export const delImages = id => {
  return request({
    url: `mp/v1_0/user/images/${id}`,
    method: 'delete'
  })
}

export const isCollect = (imageId, collect) => {
  return request({
    url: `mp/v1_0/user/images/${imageId}`,
    method: 'put',
    data: {
      collect
    }
  })
}
